/**
 * 
 */
package com.kadapatha.service.exception;

import java.util.ArrayList;
import java.util.List;

import com.kadapatha.service.exception.Message.MessageType;

public class ServiceException extends Exception {

	private static final String DEFULT_ERROR_CODE = "defult_error_code";
	private List<Message> messages;

	private static final long serialVersionUID = 1L;

	public ServiceException() {
		super();
		this.messages = new ArrayList<Message>();
	}

	public ServiceException(String message) {
		this();
		this.messages.add(new Message(message, DEFULT_ERROR_CODE,
				MessageType.ERROR));
	}

	public void addMessage(String message, String code, MessageType messageType) {
		this.messages.add(new Message(message, code, messageType));
	}

	public ServiceException(Throwable cause) {
		super(cause);
	}

	public ServiceException(String message, Throwable cause) {
		super(message, cause);
	}

}
